﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Pages/WebMaster.Master" AutoEventWireup="true" CodeBehind="ProductOrder.aspx.cs" Inherits="MaxStudio.Concrete.Web.Pages.ProductOrder" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script language="javascript" type="text/javascript">
        function CloseDialog() {
            $("#dialog").dialog("close");
        }
        function CloseEditDialog() {
            $("#EditDialog").dialog("close");
        }
        function OpenDialog() {
            $("#EditDialog").dialog("open");
            return false;
        }
        function OpenConfirmDialog() {
            $("#dialog-confirm").dialog("open");
            return false;
        }
        function CloseConfirmDialog() {
            $("#dialog-confirm").dialog("close");
            return false;
        }
        $(function() {
            var dlg = jQuery("#dialog").dialog({
                draggable: true,
                resizable: true,
                closed: true,
                show: 'Transfer',
                hide: 'Transfer',
                autoOpen: false,
                width: 600,
                minHeight: 10,
                minwidth: 10
            });
            dlg.parent().appendTo(jQuery("form:first"));

            var Editdlg = jQuery("#EditDialog").dialog({
                draggable: true,
                resizable: true,
                closed: true,
                show: 'Transfer',
                hide: 'Transfer',
                autoOpen: false,
                width: 600,
                minHeight: 10,
                minwidth: 10
            });
            Editdlg.parent().appendTo(jQuery("form:first"));

            var confirm = jQuery("#dialog-confirm").dialog({
                draggable: true,
                resizable: true,
                closed: true,
                show: 'Transfer',
                hide: 'Transfer',
                autoOpen: false,
                width: 300,
                minHeight: 10,
                minwidth: 10
            });
            confirm.parent().appendTo(jQuery("form:first"));
        });
        $(function() {
            $("#dialog-confirm").dialog({
                resizable: false,
                autoOpen: false,
                height: 140,
                modal: true
            });
        });

           
    </script>

    <div class="LinkMap">
        >>我的位置 >> 应收款管理 >> 应收款管理
    </div>
    <div>
        <div id="tabs">
            <ul>
                <li><a href="#tabs-1">功能介绍</a></li>
                <li><a href="#tabs-2">销售单管理</a></li>
            </ul>
            <div id="tabs-1">
                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
                incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
                exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
            <div id="tabs-2">
                <div style="width: auto; margin: 10px;">
                    <p>
                        <a href="#" id="dialog_link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin">
                        </span>添加销售单</a></p>
                    <!-- ui-dialog -->
                    <div id="dialog" title="添加应收款">
                        <div style="height: auto;">
                            <div>
                                <div style="width: 100px; float: left">
                                    合同编号:</div>
                                <div>
                                    <asp:DropDownList runat="server" ID="ddlContranctId">
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div>
                                <div style="width: 100px; float: left">
                                    是否开始付款:</div>
                                <asp:DropDownList runat="server" ID="ddlHaveBill">
                                    <asp:ListItem Value="1">是</asp:ListItem>
                                    <asp:ListItem Value="0">否</asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <div>
                                <div style="width: 100px; float: left">
                                    金额:</div>
                                <asp:TextBox runat="server" ID="txtAmount" SkinID="SHORTTB"></asp:TextBox>
                            </div>
                            <div>
                                <div style="width: 100px; float: left">
                                    跟单员:</div>
                                <asp:DropDownList runat="server" ID="ddlTraker">
                                </asp:DropDownList>
                            </div>
                            <div>
                                <div style="width: 100px; float: left">
                                    跟单次数:</div>
                                <asp:DropDownList runat="server" ID="ddlRound">
                                    <asp:ListItem>1</asp:ListItem>
                                    <asp:ListItem>2</asp:ListItem>
                                    <asp:ListItem>3</asp:ListItem>
                                    <asp:ListItem>4</asp:ListItem>
                                    <asp:ListItem>5</asp:ListItem>
                                    <asp:ListItem>6</asp:ListItem>
                                    <asp:ListItem>7</asp:ListItem>
                                    <asp:ListItem>8</asp:ListItem>
                                    <asp:ListItem>9</asp:ListItem>
                                    <asp:ListItem>10</asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <div>
                                <div style="width: 100px; float: left">
                                    状态:</div>
                                <asp:DropDownList runat="server" ID="ddlStatus">
                                </asp:DropDownList>
                            </div>
                            <div>
                                <div style="width: 100px; float: left">
                                    备注:</div>
                                <asp:TextBox runat="server" ID="txtDescription" SkinID="SHORTTB" TextMode="MultiLine"></asp:TextBox>
                            </div>
                            <br />
                            <div style="width: 500px; text-align: right">
                                <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click"
                                    OnClientClick="CloseDialog()" />
                                <input id="btnCancel" type="button" value="Cancel" onclick="CloseDialog()" />
                            </div>
                        </div>
                    </div>
                    <!-- ui- edit dialog -->
                    <div id="EditDialog" title="联系人修改">
                        <asp:UpdatePanel ID="UPEdit" runat="server">
                            <ContentTemplate>
                                <div style="height: auto;">
                                    <asp:Label runat="server" ID="lbEidtId" Visible="false"></asp:Label>
                                    <div>
                                        <div style="width: 100px; float: left">
                                            合同编号:</div>
                                        <div>
                                            <asp:DropDownList runat="server" ID="ddlEditContranctId">
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                    <div>
                                        <div style="width: 100px; float: left">
                                            是否开始付款:</div>
                                        <asp:DropDownList runat="server" ID="ddlEditHaveBill">
                                            <asp:ListItem Value="1">是</asp:ListItem>
                                            <asp:ListItem Value="0">否</asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                    <div>
                                        <div style="width: 100px; float: left">
                                            金额:</div>
                                        <asp:TextBox runat="server" ID="txtEditAmount" SkinID="SHORTTB"></asp:TextBox>
                                    </div>
                                    <div>
                                        <div style="width: 100px; float: left">
                                            跟单员:</div>
                                        <asp:DropDownList runat="server" ID="ddlEditTraker">
                                        </asp:DropDownList>
                                    </div>
                                    <div>
                                        <div style="width: 100px; float: left">
                                            跟单次数:</div>
                                        <asp:DropDownList runat="server" ID="ddlEditRound">
                                            <asp:ListItem>1</asp:ListItem>
                                            <asp:ListItem>2</asp:ListItem>
                                            <asp:ListItem>3</asp:ListItem>
                                            <asp:ListItem>4</asp:ListItem>
                                            <asp:ListItem>5</asp:ListItem>
                                            <asp:ListItem>6</asp:ListItem>
                                            <asp:ListItem>7</asp:ListItem>
                                            <asp:ListItem>8</asp:ListItem>
                                            <asp:ListItem>9</asp:ListItem>
                                            <asp:ListItem>10</asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                    <div>
                                        <div style="width: 100px; float: left">
                                            状态:</div>
                                        <asp:DropDownList runat="server" ID="ddlEditStatus">
                                        </asp:DropDownList>
                                    </div>
                                    <div>
                                        <div style="width: 100px; float: left">
                                            备注:</div>
                                        <asp:TextBox runat="server" ID="txtEditDescription" SkinID="SHORTTB" TextMode="MultiLine"></asp:TextBox>
                                    </div>
                                    <div>
                                        最后修改人:
                                        <asp:Label runat="server" ID="lbLastModier"></asp:Label>
                                    </div>
                                    <div>
                                        最后修改时间:
                                        <asp:Label runat="server" ID="lbLastModifyDate"></asp:Label>
                                    </div>
                                    <br />
                                    <div style="width: 500px; text-align: right">
                                        <asp:Button ID="btnEdit" runat="server" Text="Submit" OnClick="btnEdit_Click" OnClientClick="CloseEditDialog()" />
                                        <input id="btnCancelEdit" type="button" value="Cancel" onclick="CloseEditDialog()" />
                                    </div>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                    <!-- ui- delete dialog -->
                    <div id="dialog-confirm" title="删除确认?">
                        <asp:UpdatePanel ID="upDelete" runat="server">
                            <ContentTemplate>
                                <p>
                                    <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
                                    确定要删除吗？</p>
                                <asp:Label runat="server" ID="lbDeleteId" Visible="false"></asp:Label>
                                <div style="width: 270px; text-align: right">
                                    <asp:Button ID="btnConfirmDelete" runat="server" Text="Submit" OnClick="btnDelete_Click"
                                        OnClientClick="CloseConfirmDialog()" />
                                    <input id="btnCancelDelete" type="button" value="Cancel" onclick="CloseConfirmDialog()" />
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                    <asp:UpdatePanel ID="UPGridView" runat="server">
                        <ContentTemplate>
                            <asp:GridView ID="gvReceivableList" runat="server" CssClass="GridViewStyle" OnRowCommand="gvReceivableList_RowCommand"
                                DataKeyNames="Id" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True"
                                OnPageIndexChanging="gvReceivableList_PageIndexChanging" PageSize="20">
                                <FooterStyle CssClass="GridViewFooterStyle" />
                                <RowStyle CssClass="GridViewRowStyle" />
                                <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
                                <PagerStyle CssClass="GridViewPagerStyle" />
                                <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
                                <HeaderStyle CssClass="GridViewHeaderStyle" />
                                <Columns>
                                    <asp:BoundField DataField="ID" HeaderText="编号" />
                                    <asp:BoundField DataField="ContranctId" HeaderText="合同编号" />
                                    <asp:BoundField DataField="Amount" HeaderText="金额" /> 
                                     <asp:TemplateField HeaderText="跟单人">
                                        <ItemTemplate>
                                            <asp:Label runat="server" ID="lblTrackerName" Text='<%# GetUserNameById(Eval("Traker").ToString()) %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                     
                                      <asp:TemplateField HeaderText="状态">
                                        <ItemTemplate>
                                            <asp:Label runat="server" ID="lblStatusName" Text='<%# GetMasterDataNameById(Eval("Status").ToString()) %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="CreateDate" HeaderText="创建时间" />
                                    <asp:BoundField DataField="ModifyDate" HeaderText="修改时间" />
                                    <asp:TemplateField HeaderText="修改">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lbtnEdit" runat="server" CausesValidation="False" CommandName="Select"
                                                Text="修改" CommandArgument='<%# Bind("Id") %>' OnClientClick="OpenDialog();"></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="删除">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lbtnDelete" runat="server" CausesValidation="False" CommandName="del"
                                                Text="删除" CommandArgument='<%# Bind("Id") %>' OnClientClick="OpenConfirmDialog()"></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
